package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.AdminSubject;
import com.ruoyi.system.mapper.AdminSubjectMapper;
import com.ruoyi.system.service.IAdminSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 课程Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-06-16
 */
@Service
public class AdminSubjectServiceImpl implements IAdminSubjectService 
{
    @Autowired
    private AdminSubjectMapper adminSubjectMapper;

    /**
     * 查询课程
     * 
     * @param subjectId 课程ID
     * @return 课程
     */
    @Override
    public AdminSubject selectAdminSubjectById(Long subjectId)
    {
        return adminSubjectMapper.selectAdminSubjectById(subjectId);
    }

    /**
     * 查询课程列表
     * 
     * @param adminSubject 课程
     * @return 课程
     */
    @Override
    public List<AdminSubject> selectAdminSubjectList(AdminSubject adminSubject)
    {
        return adminSubjectMapper.selectAdminSubjectList(adminSubject);
    }

    /**
     * 新增课程
     * 
     * @param adminSubject 课程
     * @return 结果
     */
    @Override
    public int insertAdminSubject(AdminSubject adminSubject)
    {
        adminSubject.setCreateTime(DateUtils.getNowDate());
        return adminSubjectMapper.insertAdminSubject(adminSubject);
    }

    /**
     * 修改课程
     * 
     * @param adminSubject 课程
     * @return 结果
     */
    @Override
    public int updateAdminSubject(AdminSubject adminSubject)
    {
        adminSubject.setUpdateTime(DateUtils.getNowDate());
        return adminSubjectMapper.updateAdminSubject(adminSubject);
    }

    /**
     * 删除课程对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAdminSubjectByIds(String ids)
    {
        return adminSubjectMapper.deleteAdminSubjectByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除课程信息
     * 
     * @param subjectId 课程ID
     * @return 结果
     */
    @Override
    public int deleteAdminSubjectById(Long subjectId)
    {
        return adminSubjectMapper.deleteAdminSubjectById(subjectId);
    }

    /**
     * 课程状态修改
     *
     * @param adminSubject 用户信息
     * @return 结果
     */
    @Override
    public int changeStatus(AdminSubject adminSubject)
    {
      return adminSubjectMapper.updateAdminSubject(adminSubject);
    }
}
